package day03;
//逻辑运算符的演示
public class OperDemo3 {
    public static void main(String[] args) {
        //3. 逻辑运算符,&&,||,!
/*        int a=5,b=10,c=5;
        System.out.println(b>=a&&b<c);//false
        System.out.println(a==b&&c>b);//false
        System.out.println(b<=c&&b>a);//false
        System.out.println(b!=c&&a<b);//true

        int age=40;
        //年龄在18到50之间
        if (age>=18&& age<=50){
            System.out.println("中年人");
        }
        int score=80;
        //成绩在60到100之间
        if (score>=60&&score<=100){
            System.out.println("及格");
        }*/
        int a=5, b=10, c=5;
        System.out.println(b>=a||b<c);//true||false=true
        System.out.println(b<=c||b>a);//false//true=true
        System.out.println(b!=c||a<b);//true||true=true
        System.out.println(a==b||b<c);//false||false=false

        int score=-8;//代入(80,100,-10)
        //验证成绩不合法(用||)
        if (score<0||score>100){
            System.out.println("成绩不合法");
        }else {
            System.out.println("成绩合法");
        }

        boolean b2=!(a<b);
        System.out.println(b2);//false

        boolean b3=a>b && c++>2;
        System.out.println(b3);//false
        System.out.println(c);//5 发生短路了

        boolean b4=a<b || c++>2;
        System.out.println(b4);//true
        System.out.println(c);//5 发生短路了
    }
}
